<?php
include_once "../header1.php";
?>
<script type="text/javascript">
function cleartbox()
{	
	document.getElementById("Sea_Sch").innerHTML="";
}
</script>
<script type="text/javascript">
function getHttpRequest()
{
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}
function showHint(str)
{
var xmlhttp;    
if (str=="")
  {
  document.getElementById("List").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("List").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","sch_names.php?q="+str,true);
xmlhttp.send();
}
function fill(val)
{
document.s_name.SchName.value=val;
document.getElementById("List").innerHTML="";
}
</script>
<script type="text/javascript">
function getRes(hin,acty)
{
	var xmlhttp;    
if (hin=="")
  {
  document.getElementById("Sea_Sch").innerHTML='<font class="err"><img src="../images/alert.jpg" width="12" height="12"/> Please enter the School name!</font>';
  return;
  }
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("Sea_Sch").innerHTML=xmlhttp.responseText;
    }
  }
  hint=hin+","+acty;
xmlhttp.open("GET","search.php?q="+hint,true);
xmlhttp.send();
}
</script>

</head>
<body>
 <?php
require_once '../Login/databaseconnection.php';
if(!loggedin())
{
require_once '../index.php';
}
else
{

?><?php
include_once "../header2.php";
?>
<?php
include_once "topmenu.php";
?>
<div id="content">
	<div id="main">
	  <div id="bodyfield">
<div id="lefttable">
<table width="530" border="0" class="tablefontv">
<tr><td width="47" height="43" class="err">
<?php
if(isset($_SESSION['errornotallo']))
	{
	echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errornotallo'];
		unset($_SESSION['errornotallo']);
	}
	if(isset($_SESSION['errornorow']))
	{
	echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errornorow'];
		unset($_SESSION['errornorow']);
	}
?>
</td></tr></table>
<table width="530" border="0" class="tablefontv">
  <tr><form name="s_name">
  <td width="14" height="50"></td>
      <td width="193">School's Name:</td>
      <td width="126">
	  <?php
	  $snam=mysql_query("SELECT * FROM school WHERE School_Id='$School_Id'");
	  if($ros=mysql_fetch_array($snam))
	  {
	  $Sch_name=$ros['Name'];
	  }
	  echo "<input type='text' id='SchName' name='SchName' onKeyUp='showHint(this.value)' value='$Sch_name' onClick='cleartbox()' size='45'/>";
	  ?>
	  </td>
      <td width="52">
      <?php 
	  $acty=$_SESSION['Access_Type'].",".$_SESSION['NIC_Number'];
	  echo " <input type='button' class='searchid' name='$acty' onClick='getRes(SchName.value,this.name)'>";
	  ?></td>
      <td width="123">
     </td></form>
  </tr>
  <tr>
  <td>
  </td>
  <td>
  </td><td>
 <div class="suggestionListsch" id="List"></div> </td>
 <td>
 </td>
 <td></td>
  </tr></table>
   <div id="Sea_Sch"> 
 </div>
</div>
  </div>
</div>
</div>
<div id="sidebar">
<br/>
<div id="partners" class="boxed">
			<h2 class="title">SCHOOLS</h2>
            </div>
    <?php
include_once "menu.php";
?>
 <?php
include_once "../footer.php";
?>
<?php
	}
?>
</body>
</html>